package com.mibox.common.ui;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.mibox.common.adapter.SettingsListAdapter;
import com.mibox.common.bean.SettingBean;
import com.mibox.common.databinding.ActivityBaseEntryBinding;

import java.util.LinkedList;

public class BaseEntryActivity extends AppCompatActivity {

    private ActivityBaseEntryBinding mB;
    private SettingsListAdapter mAdapter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mB = ActivityBaseEntryBinding.inflate(getLayoutInflater());
        setContentView(mB.getRoot());
        mAdapter = new SettingsListAdapter();
        setupAdapter();
    }

    private void setupAdapter() {
        mB.textEntryList.setAdapter(mAdapter);
        mAdapter.setOnItemClickListener((adapter, view, position) ->
                mAdapter.getItem(position).listener.onClick());
        LinkedList<SettingBean> dataList = new LinkedList<>();
        addPageEntries(dataList);
        mAdapter.setList(dataList);
    }

    protected void addPageEntries(LinkedList<SettingBean> entries) {
    }
}
